package org.geektimes.configuration.microprofile.config.source;

import org.eclipse.microprofile.config.spi.ConfigSource;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @Author: menglinggang
 * @Date: 2021-03-15
 * @Time: 3:35 下午
 */
public class MemoryConfigSource implements ConfigSource {

    private static Map<String, String> memoryMap = new HashMap<>();

    static {
        memoryMap.put("user.name", "zhangsan");
        memoryMap.put("user.age", "10");
        memoryMap.put("config_ordinal", "200");
    }

    public MemoryConfigSource(){
    }

    @Override
    public Set<String> getPropertyNames() {
        return Collections.unmodifiableSet(memoryMap.keySet());
    }

    @Override
    public String getValue(String s) {
        return memoryMap.get(s);
    }

    @Override
    public String getName() {
        return "java memory";
    }
}
